package com.coconut.model;

import java.util.Date;
import java.util.List;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.UniqueConstraint;

import org.appfuse.model.User;
import org.hibernate.annotations.IndexColumn;

@Entity
@Table(name = "testsuit")
public class TestSuit {
	@Id
	@GeneratedValue(strategy = GenerationType.AUTO)
	@Column(name = "id")
	private long id;

	@Column
	private String linkId;
	@Column
	private String title;
	@Column(length = 5000)
	private String text;
	@ManyToOne
	private User createdBy;
	@Column
	private Date createdTime;
	@ManyToOne
	private User lastModifiedBy;
	@Column
	private Date lastModified;

	@OneToMany(cascade = { javax.persistence.CascadeType.ALL })
	@JoinTable(joinColumns = @JoinColumn(name = "suit_id", nullable = false), inverseJoinColumns = @JoinColumn(name = "step_id", nullable = false), uniqueConstraints = @UniqueConstraint(columnNames = {
			"suit_id", "step_id" }))
	@IndexColumn(name = "indx")
	private List<Step> steps;

	public long getId() {
		return id;
	}

	public void setId(final long id) {
		this.id = id;
	}

	public String getLinkId() {
		return linkId;
	}

	public void setLinkId(final String linkId) {
		this.linkId = linkId;
	}

	public String getTitle() {
		return title;
	}

	public void setTitle(final String title) {
		this.title = title;
	}

	public String getText() {
		return text;
	}

	public void setText(final String text) {
		this.text = text;
	}

	public User getCreatedBy() {
		return createdBy;
	}

	public void setCreatedBy(final User createdBy) {
		this.createdBy = createdBy;
	}

	public Date getCreatedTime() {
		return createdTime;
	}

	public void setCreatedTime(final Date createdTime) {
		this.createdTime = createdTime;
	}

	public Date getLastModified() {
		return lastModified;
	}

	public void setLastModified(final Date lastModified) {
		this.lastModified = lastModified;
	}

	public User getLastModifiedBy() {
		return lastModifiedBy;
	}

	public void setLastModifiedBy(final User lastModifiedBy) {
		this.lastModifiedBy = lastModifiedBy;
	}

	public List<Step> getSteps() {
		return steps;
	}

	public void setSteps(final List<Step> steps) {
		this.steps = steps;
	}

}
